﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;

namespace PFMGlobals
{
    public static class PFMDefinitions
    {
        public static string ZIPHANDLER = "ZIP";
        public static string DIRECTORYHANDLER = "DIRECTORY";
        public static string NULLHANDLER = "NULL";
        public static string DBHANDLER = "DB";
        public static string LOGHANDLER = "LOG";
        public static string UNZIPHANDLER = "UNZIP";
        public static string ENCODEHANDLER = "ENCODE";
        public static string DECODEHANDLER = "DECODE";
        public static string FILEHANDLER = "FILE";
        public static string FILEFINDER = "FILEFINDER";

        public static string EVERYDAY = "EVERYDAY";
        public static string MONDAY = "MONDAY";
        public static string TUESDAY = "TUESDAY";
        public static string WEDNESDAY = "WENDESDAY";
        public static string THURSDAY = "THURSDAY";
        public static string FRIDAY = "FRIDAY";
        public static string SATURDAY = "SATURDAY";
        public static string SUNDAY = "SUNDAY";

        public static string SCHEDULEDTASK = "SCHEDULEDTASK";
        public static string SPECIFIEDTASK = "SPECIFIEDTASK";

        public static string CONFIGURATIONSDIR = @"E:\代码库\Solution1\PFMConfigurations\";

        public static CspParameters param;
        public static byte[] buffer;
        public static string strLine;
        public static DESCryptoServiceProvider DesCSP = new DESCryptoServiceProvider();

        public static List<T> ToList<T>(this string str, string split)
        {
            if (!string.IsNullOrEmpty(str))
            {
                string[] arr = str.Split(new char[] { Convert.ToChar(split) });
                if (typeof(T) == typeof(int))
                {
                    //int[] arri = Array.ConvertAll(arr, new Converter<string, int>(StrToInt));
                    int[] arrInt = Array.ConvertAll<string, int>(arr, delegate(string s) { return int.Parse(s); });
                    List<int> list = new List<int>(arrInt);
                    return list as List<T>;
                }
                else if (typeof(T) == typeof(string))
                {
                    List<string> list = new List<string>(arr);
                    return list as List<T>;
                }
                else
                {
                    return new List<T>();
                }
            }
            else
            {
                return new List<T>();
            }
        }



    }
}
